﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DeviceInfoManage.BusinessLogicLayer;
using System.Text;

public partial class FileUpload : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            PageInit();
        }
    }

    private void PageInit()
    {
        if (Session["adminUserName"] == null)
        {
            Response.Redirect("login.aspx");
            return;
        }

        FileType ft = new FileType();
        ddlfileType.DataSource = ft.GetFileType();
        ddlfileType.DataTextField = "fileTypeName";
        ddlfileType.DataValueField = "fileTypeId";
        ddlfileType.DataBind();

        hidFolder.Value = "UpFiles/" + HttpUtility.UrlEncode(HttpUtility.UrlEncode(ddlfileType.SelectedItem.Text));
        hidFileType.Value = HttpUtility.UrlEncode(HttpUtility.UrlEncode(ddlfileType.SelectedItem.Text));
        hidUploadUser.Value = Session["adminUserName"].ToString();
    }

    protected void ddlfileType_SelectedIndexChanged(object sender, EventArgs e)
    {
        hidFolder.Value = "UpFiles/" + HttpUtility.UrlEncode(HttpUtility.UrlEncode(ddlfileType.SelectedItem.Text));
        hidFileType.Value = HttpUtility.UrlEncode(HttpUtility.UrlEncode(ddlfileType.SelectedItem.Text));
    }
}
